/*
 * WidgetButton.h
 *
 *	Author: stravant
 *	Description:
 *		
 */

#ifndef WIDGETBUTTON_H_
#define WIDGETBUTTON_H_

#include "../core/Include.h"
#include "../ui/Canvas.h"
#include "../ui/Widget.h"
#include "../ui/WidgetTraits.h"
#include "../ui/Animation.h"

namespace tbt {

class WidgetButton: public Widget, public AnimationDelegate,
	public TraitBackgroundColor, public TraitTextColor, public TraitFontSize {
public:
	WidgetButton();
	~WidgetButton();

	fx::Surface* getImage() const {return mImage; }
	void setImage(fx::Surface* image) {mImage = image; }

	const String& getText() const {return mText; }
	void setText(const String& txt) {mText = txt; }

	virtual void onPaint(const IRect& region, fx::Context* ctx);
	virtual void onEvent_Crossing(const MouseEvent& e);
	virtual void onEvent_Button(const MouseButtonEvent& e);

	virtual void animationProgressed(Animation* anim);
private:
	AnimationSlide mHoverAnimation;

	bool mPressed;
	bool mHover;
	fx::Pattern* mGradient;
	fx::Surface* mImage;
	String mText;
};

}

#endif /* WIDGETBUTTON_H_ */
